package com.gjy.service.uuid.event;

import com.lmax.disruptor.EventHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * @author gjy
 * @version 1.0
 * @since 2025-10-12 10:21:21
 */
@Component
public class UuidEventHandler implements EventHandler<UuidEvent> {

    private static final Logger logger = LoggerFactory.getLogger(UuidEventHandler.class);

    @Override
    public void onEvent(UuidEvent event, long sequence, boolean endOfBatch) throws Exception {
        try {
            // 处理UUID生成事件
            logger.info("Processing UUID event: {}", event);

            // 这里可以添加额外的处理逻辑，比如：
            // - 记录到数据库
            // - 发送到消息队列
            // - 更新统计信息等

        } catch (Exception e) {
            logger.error("Error processing UUID event: {}", event, e);
        }
    }
}
